n, m, *a = map(int, open(0).read().split()); z = 2*n*(m-1); N = 1< c2: v2 = (a[i+1]< 1: s += 1; v1 //= 2; v2 //= 2 z += d-2*s print(z)